import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { basCarListData } from '/@/api/bas/car/basCar';

const { t } = useI18n('sys.empUser');

const modalProps = {
  title: t('车辆选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 100,
  showResetButton:false,
  schemas: [
    {
      label: t('车牌号码'),
      field: 'cphm',
      component: 'Input',
    },
    {
      label: t('品牌型号'),
      field: 'ppxh',
      component: 'Input',
    },
    {
      label: t('车辆类型'),
      field: 'cllx',
      component: 'Select',
      componentProps: {
        dictType: 'car_type',
      },
      show: false,
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('车辆状态'),
    dataIndex: 'clzt',
    dictType: 'car_status',
    key: 'a.clzt',
    sorter: true,
    width: 100,
    align: 'center',
    fixed: 'left',
  },
  {
    title: t('车牌号码'),
    dataIndex: 'cphm',
    key: 'a.cphm',
    sorter: true,
    width: 100,
    align: 'left',
    fixed: 'left',
    slot: 'firstColumn',
  },
  {
    title: t('品牌型号'),
    dataIndex: 'ppxh',
    key: 'a.ppxh',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('车辆类型'),
    dataIndex: 'cllx',
    key: 'a.cllx',
    sorter: true,
    width: 130,
    align: 'center',
    dictType: 'car_type',
  },
  {
    title: t('使用性值'),
    dataIndex: 'syxz',
    key: 'a.syxz',
    sorter: true,
    width: 130,
    align: 'center',
    dictType: 'car_use_type',
  },
  {
    title: t('车辆所有人'),
    dataIndex: 'clsyr',
    key: 'a.clsyr',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('座位数'),
    dataIndex: 'zws',
    key: 'a.zws',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('默认驾驶员'),
    dataIndex: 'driver.userName',
    key: 'a.mrjsy',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('联系电话'),
    dataIndex: 'lxdh',
    key: 'a.lxdh',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('发动机号码'),
    dataIndex: 'fdjhm',
    key: 'a.fdjhm',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('车辆识别代号'),
    dataIndex: 'clsbdh',
    key: 'a.clsbdh',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('新能源汽车'),
    dataIndex: 'xnyqc',
    key: 'a.xnyqc',
    dictType: 'sys_yes_no',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('车体颜色'),
    dataIndex: 'ctys',
    key: 'a.ctys',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('车辆配置'),
    dataIndex: 'clpz',
    key: 'a.clpz',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('核定载人数'),
    dataIndex: 'hdzrs',
    key: 'a.hdzrs',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('整备质量(Kg)'),
    dataIndex: 'zbzl',
    key: 'a.zbzl',
    sorter: true,
    width: 150,
    align: 'center',
  },
  {
    title: t('总质量'),
    dataIndex: 'zzl',
    key: 'a.zzl',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('变速器型式'),
    dataIndex: 'bsqxs',
    key: 'a.bsqxs',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('发动机排量'),
    dataIndex: 'fdjpl',
    key: 'a.fdjpl',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('油箱容积'),
    dataIndex: 'yxrj',
    key: 'a.yxrj',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('保养周期'),
    dataIndex: 'byzq',
    key: 'a.byzq',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('销售单位'),
    dataIndex: 'xsdw',
    key: 'a.xsdw',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('购车时间'),
    dataIndex: 'gcsj',
    key: 'a.gcsj',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('购车价格'),
    dataIndex: 'gcjg',
    key: 'a.gcjg',
    sorter: true,
    width: 130,
    align: 'right',
  },
  {
    title: t('注册登记日期'),
    dataIndex: 'zcdjrq',
    key: 'a.zcdjrq',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('发证日期'),
    dataIndex: 'fzrq',
    key: 'a.fzrq',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('年检日期'),
    dataIndex: 'njrq',
    key: 'a.njrq',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('保险到期'),
    dataIndex: 'bxdq',
    key: 'a.bxdq',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('限行标志'),
    dataIndex: 'xxbz',
    key: 'a.xxbz',
    sorter: true,
    width: 130,
    align: 'center',
  },
  {
    title: t('录入人员'),
    dataIndex: 'cldaLrry',
    key: 'a.clda_lrry',
    sorter: true,
    width: 130,
    align: 'left',
  },
  {
    title: t('状态'),
    dataIndex: 'status',
    key: 'a.status',
    sorter: true,
    width: 130,
    align: 'center',
    dictType: 'sys_search_status',
  },
];

const tableProps: BasicTableProps = {
  api: basCarListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'cphm',
  itemName: 'cphm',
  isShowCode: true,
};
